<template>
  <div class="product-detail">
    <RouterLink to="/">
      <img v-img-lazy="good.picture" alt="" />
      <p class="title">{{ good.name }}</p>
      <p class="desc">{{ good.desc }}</p>
      <p class="price">¥{{ good.price }}</p>
    </RouterLink>
  </div>
</template>

<script setup>
defineProps({
  good: {
    id: Number,
    name: String,
    desc: String,
    price: Number,
    picture: String
  }
})
</script>

<style lang="scss" scoped>
.product-detail {
  width: 220px;
  height: 100%;
  text-align: center;
  padding: 20px 30px;
  transition: all .5s;

  &:hover {
    transform: translate3d(0, -5px, 0);
    box-shadow: 0 3px 8px rgb(0 0 0/20%);
  }

  .title {
    font-size: 16px;
    margin-top: 5px;

    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
  }

  .desc {
    font-size: 14px;
    margin: 5px 0;
    color: #999;

    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
  }

  .price {
    font-size: 20px;
    color: $priceColor;
  }

  img {
    width: 160px;
    height: 160px;
  }
}
</style>
